package com.gxuwz.eschool;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
//公寓洗澡
public class BatheActivity extends AppCompatActivity {

    private ImageView iv_back;
    private Button btn_bathe;
    private Button btn_scan_code;
    private Button btn_reservation;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_bathe);
        iv_back = findViewById(R.id.iv_back);
        iv_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // 使用SupportFragmentManager来管理Fragment事务
                FragmentManager fragmentManager = getSupportFragmentManager();

                // 检查是否有Fragment可以回退
                if (fragmentManager.getBackStackEntryCount() > 0) {
                    fragmentManager.popBackStack(); // 返回上一个Fragment
                } else {
                    // 如果没有Fragment可以回退，可以结束当前Activity
                    finish();
                }
            }
        });
        btn_bathe = findViewById(R.id.btn_bathe);
        btn_scan_code = findViewById(R.id.btn_scan_code);
        btn_reservation = findViewById(R.id.btn_reservation);
        setupClickListener(btn_bathe);
        setupClickListener(btn_scan_code);
        setupClickListener(btn_reservation);

    }
    private void setupClickListener(final TextView textView) {
        textView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new AlertDialog.Builder(BatheActivity.this)
                        .setTitle("提示")
                        .setMessage("该功能暂不可使用！")
                        .setPositiveButton("完成", null)
                        .show();
            }
        });
    }
}